package com.imooc.miaosha.util;

import org.apache.commons.lang3.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ValidatorUtil {

    private static final Pattern mobile_pattern = Pattern.compile("1\\d{10}");

    /**
     * 验证手机号
     *
     * @param mobileStr 手机号
     * @return 结果
     */
    public static boolean isMobile(String mobileStr) {
        if (StringUtils.isEmpty(mobileStr)) {
            return false;
        }
        Matcher m = mobile_pattern.matcher(mobileStr);
        return m.matches();
    }

}
